﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MimiDouban.Abstract
{
    /// <summary>
    /// 播放器抽象接口
    /// </summary>
    public interface IPlayer
    {
        /// <summary>
        /// 当前是否暂停状态
        /// </summary>
        /// <returns>当前是否是暂停状态</returns>
        bool isPaused();

        /// <summary>
        /// 播放一首歌
        /// </summary>
        /// <param name="url">歌曲URL</param>
        void play(string url);

        /// <summary>
        /// 暂停当前播放
        /// </summary>
        void pause();

        /// <summary>
        /// 恢复当前播放
        /// </summary>
        void resume();

        /// <summary>
        /// 停止当前播放
        /// </summary>
        void stop();

        /// <summary>
        /// 设置音量
        /// </summary>
        /// <param name="vol">新的音量</param>
        void setVolume(double vol);

        double getVolume();

        /// <summary>
        /// 销毁播放器
        /// </summary>
        void distroy();

        /// <summary>
        /// 开始缓冲事件
        /// </summary>
        event PlayerEventHandler BufferingBegin;

        /// <summary>
        /// 缓冲结束事件
        /// </summary>
        event PlayerEventHandler BufferingEnd;

        /// <summary>
        /// 播放失败事件
        /// </summary>
        event PlayerFailedEventHandler PlayFailed;

        /// <summary>
        /// 播放结束事件
        /// </summary>
        event PlayerEventHandler PlayFinished;

        /// <summary>
        /// 时间跳动事件
        /// </summary>
        event PlayerTickEventHandler PlayerTicked;
        
    }

    public delegate void PlayerEventHandler();
    public delegate void PlayerFailedEventHandler(Exception e);
    public delegate void PlayerTickEventHandler(int current);
}
